import { _decorator, Component, Node, Prefab } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('DyPrefab')
export class DyPrefab extends Component {
    private _prefab: Prefab = null;
    protected onLoad(): void {
        if (this.node['prefab']) {
            let prefb = this.node['prefab'];
            if (prefb.asset) {
                this._prefab = prefb.asset;
                this._prefab.addRef();
            }
        }
    }

    protected onDestroy(): void {
        if (this._prefab) {
            this._prefab.decRef();
            this._prefab = null;
        }
    }
}


